<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>form</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <style>
        .demo-table-expand {
            font-size: 0;
        }

        .demo-table-expand label {
            width: 90px;
            color: #99a9bf;
        }

        .demo-table-expand .el-form-item {
            margin-right: 0;
            margin-bottom: 0;
            width: 50%;
        }

        th,
        td {
            text-align: center !important;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- Form -->
        <el-button type="text" @click="dialogFormVisible = true">打开嵌套表单的 Dialog</el-button>

        <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
            <el-form :model="form">
                <el-form-item label="活动名称" :label-width="formLabelWidth">
                    <el-input v-model="form.name" auto-complete="off"></el-input>
                </el-form-item>
                <el-form-item label="活动区域" :label-width="formLabelWidth">
                    <el-select v-model="form.region" placeholder="请选择活动区域">
                        <el-option label="区域一" value="shanghai"></el-option>
                        <el-option label="区域二" value="beijing"></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
            </div>
        </el-dialog>
        <el-table :data="tableData3" style="width: 100%" border max-height="900" align="center">
            <el-table-column type="expand">
                <template slot-scope="props">
                    <el-form label-position="left" inline class="demo-table-expand">
                        <el-form-item label="中文名">
                            <span>{{ props.row.name }}</span>
                        </el-form-item>
                        <el-form-item label="参数名称">
                            <span>{{ props.row.shop }}</span>
                        </el-form-item>
                        <el-form-item label="参数值">
                            <span>{{ props.row.id }}</span>
                        </el-form-item>
                        <el-form-item label="标准名">
                            <span>{{ props.row.shopId }}</span>
                        </el-form-item>
                        <el-form-item label="级别">
                            <span>{{ props.row.category }}</span>
                        </el-form-item>
                        <el-form-item label="上级名">
                            <span>{{ props.row.address }}</span>
                        </el-form-item>
                    </el-form>
                </template>
            </el-table-column>
            <el-table-column label="非标准">
                <el-table-column prop="name" label="中文名" width="150">
                </el-table-column>
                <el-table-column prop="name" label="英文名">
                </el-table-column>
                <el-table-column prop="name" label="值">
                </el-table-column>
            </el-table-column>
            <el-table-column label="标准">
                <el-table-column prop="date" label="标准名">
                </el-table-column>
            </el-table-column>
            <el-table-column label="辅助">
                <el-table-column prop="name" label="级别">
                </el-table-column>
                <el-table-column prop="name" label="上级名">
                </el-table-column>
            </el-table-column>
            <el-table-column label="操作" fixed="right" width="300">
                <template slot-scope="scope">
                    <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                    <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                    <el-button size="mini" type="success" @click="handleEdit(scope.$index, scope.row)">添加下级树结构</el-button>
                </template>
            </el-table-column>
        </el-table>

    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    tableData3: [{
                            date: '2016-05-03',
                            name: 'key',
                            province: '上海',
                            city: '普陀区',
                            address: '上海市普陀区金沙江路 1518 弄',
                            zip: 200333
                        },
                        //  {
                        //     date: '2016-05-02',
                        //     name: '王小虎',
                        //     province: '上海',
                        //     city: '普陀区',
                        //     address: '上海市普陀区金沙江路 1518 弄',
                        //     zip: 200333
                        // }, {
                        //     date: '2016-05-04',
                        //     name: '王小虎',
                        //     province: '上海',
                        //     city: '普陀区',
                        //     address: '上海市普陀区金沙江路 1518 弄',
                        //     zip: 200333
                        // }, {
                        //     date: '2016-05-01',
                        //     name: '王小虎',
                        //     province: '上海',
                        //     city: '普陀区',
                        //     address: '上海市普陀区金沙江路 1518 弄',
                        //     zip: 200333
                        // }, {
                        //     date: '2016-05-08',
                        //     name: '王小虎',
                        //     province: '上海',
                        //     city: '普陀区',
                        //     address: '上海市普陀区金沙江路 1518 弄',
                        //     zip: 200333
                        // }, {
                        //     date: '2016-05-06',
                        //     name: '王小虎',
                        //     province: '上海',
                        //     city: '普陀区',
                        //     address: '上海市普陀区金沙江路 1518 弄',
                        //     zip: 200333
                        // }, {
                        //     date: '2016-05-07',
                        //     name: '王小虎',
                        //     province: '上海',
                        //     city: '普陀区',
                        //     address: '上海市普陀区金沙江路 1518 弄',
                        //     zip: 200333
                        // }
                    ],
                    dialogFormVisible: false,
                    form: {
                        name: '',
                        region: '',
                        date1: '',
                        date2: '',
                        delivery: false,
                        type: [],
                        resource: '',
                        desc: ''
                    },
                    formLabelWidth: '120px'
                }
            },
            methods: {
                handleEdit(index, row) {
                    console.log(index, row);
                },
                handleDelete(index, row) {
                    console.log(index, row);
                }
            }
        })
    </script>
</body>

</html>